<template>
    <div class="handler-box">
        <div v-for="item in agreeList" :key="item.title"
             class="side-card handler-item" :class="{sub: item.id === app.specialFlag}">
            <router-link to="special" @click="app.specialFlag = item.id">
                <div class="title">{{ item.title }}</div>
                <img :src="item.img" alt="not found">
            </router-link>
        </div>
    </div>
</template>

<script setup lang="ts">

import useStore from "@/store";

const {app} = useStore();

const agreeList = [
    {
        id: 1,
        title: "约会",
        img: "/src/assets/images/agree/appointment.jpg",
    },
    {
        id: 2,
        title: "活动",
        img: "/src/assets/images/agree/activity.jpg",
    },
    {
        id: 3,
        title: "赛事",
        img: "/src/assets/images/agree/competition.jpg",
    },
    {
        id: 4,
        title: "帮助",
        img: "/src/assets/images/agree/help.jpg",
    },
]

</script>

<style scoped lang="scss">
.handler-box {
  width: 98%;
  margin: 1.4rem auto 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;

  .handler-item {
    position: relative;
    width: 6rem;
    height: 3rem;
    padding: 0;
    overflow: hidden;
    filter: brightness(0.4);
    transition: 0.6s;

    &:hover {
      filter: brightness(0.8);
    }

    .title {
      position: absolute;
      top: 0;
      width: 100%;
      text-align: center;
      line-height: 2.7rem;
      font-size: 1rem;
    }

    img {
      width: 100%;
      height: 100%;
      background-position: center;
      background-size: cover;
    }
  }

  .handler-item.sub {
    filter: none;
  }
}

@media (max-width: 36rem) {
  .handler-item {
    width: 4rem !important;
    height: 2rem !important;

    .title {
      font-size: 0.6rem !important;
      line-height: 1.9rem !important;
    }
  }
}
</style>